package org.tea.inventory.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author hanzy
 * @description 福利活动商品定时上架
 * @date 2023年04月10日 16:37
 */
@Slf4j
@Service
public class WelfareGoodScheduled {
    /*@Autowired
    private IMallWelfareService mallWelfareService;*/

    /**
     * @description: 每天零时1点上架福利商品
     * @param:
     * @return: void
     * @author hzy
     * @date: 2023/4/13 16:18
     */
    /*@Scheduled(cron = "0 0 1 * * ?")
    public void uploadSeckillSkuLatest3Days() {
        //1、重复上架无需处理
        log.info("上架商品...");
        //分布式锁
        RLock lock = RedisLockUtil.lock(MallLockConstant.UPLOAD_LOCK);
        try {
            //加锁
            lock.lock(10, TimeUnit.SECONDS);
            mallWelfareService.uploadSkuLatest3Days();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            lock.unlock();
        }
    }*/

    /**
     * @description: 每天零时1分钟下架活动
     * @param:
     * @return: void
     * @author hzy
     * @date: 2023/4/13 16:19
     */
    /*@Scheduled(cron = "0 1 0 * * ?")
    public void underSeckillSkuEndTiemLast1Days() {
        log.info("下架活动...");
        try {
            mallWelfareService.underSeckillSkuEndTimeYesterday();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }*/
}
